import router from '@/router';

export const setInerceptors = (axiosInstance) => {
  axiosInstance.interceptors.request.use(request => request, error => Promise.reject(error));
  axiosInstance.interceptors.response.use(response => {
    if (response.data.code === -1) {
      router.replace('/root/auth/login');
    }
    return response;
  }, error => Promise.reject(error));
};
